package com.mti.ftp.service.impl;

import com.mti.ftp.service.FtpService;
import com.mti.ftp.util.FtpUtils;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

@Service
@Log4j2
public class FtpServiceImpl implements FtpService {

    @Autowired
    FtpUtils ftpUtils;

    @Async("ftpTaskExecutor")
    @Override
    public void uploadFile(File file) throws IOException {
        ftpUtils.uploadFile(file);
    }

    @Override
    public InputStream downloadFile(String remoteFilePath) throws IOException {
        return ftpUtils.downloadFile(remoteFilePath);
    }


}